<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCourseTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('courses', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->integer('speaker_id')->comment('授课老师');
            $table->integer('creator_id')->comment('创建人');
            $table->date('course_date')->comment('课程日期');
            $table->char('start_time',5);
            $table->char('end_time',5);
            $table->tinyInteger('record_state')->comment('录制状态（0.未录制，1.录制中，2.录制非正常停止，3录制完成，4超过15分钟还未开启）')->default(0);
            $table->integer('class_id');
            $table->integer('phase_id')->nullable();
            $table->integer('grade_id')->nullable();
            $table->integer('subject_id')->nullable();
            $table->string('section_index')->nullable();
            $table->integer('video_id')->nullable();
            $table->integer('school_id');
            $table->tinyInteger('type')->comment('类型 1普通录课 2直播（公开课）3手机扫码录课')->default(1);
            $table->string('cover_url')->nullable();
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('courses');
    }
}
